#ifndef __SQLITE_SQL_RECORD_H_
#define __SQLITE_SQL_RECORD_H_

#include "sqlite3.h"
#include <string>
#include <map>
#include <vector>
#include <list>
#include <stdio.h>

struct st_field
{
    st_field( )
    {

    }

    bool operator < (const st_field& obj)
    {
        return i_index < obj.i_index;
    }

    std::string str_field;
    int     i_index;
};

class st_sql_record
{
public:
    st_sql_record();
    virtual ~st_sql_record();

public:
    bool is_eof();
    bool move_next();

    bool get_field_value( std::string &str_field, int &i_value );
    bool get_field_value( std::string &str_field, unsigned int &ui_value );
    bool get_field_value( std::string &str_field, long long &i_value );
    bool get_field_value( std::string &str_field, std::string &str );
    bool get_field_value( std::string &str_field, const void* &p_buffer, int &i_len );
    void get_fields( std::vector<std::string> &field_vec );

    bool init();
    bool exit();

public:
    sqlite3_stmt *mp_sql_stmt;

private:
    bool mb_empty;
    bool mb_is_eof;

    int  mi_row_index;
    int  mi_cols;

    std::map<std::string, int> m_col_map;
};


#endif
